package com.fileshare.web.dao;

import com.fileshare.web.dto.Vo.AuthorityVo;
import com.fileshare.web.entity.Authority;
import com.fileshare.web.entity.RoleAuthority;
import com.fileshare.web.entity.UserRole;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface AuthorityRepository {

    List<RoleAuthority> getRoleAuthorities(UserRole userRole);

    Authority getAuthority(RoleAuthority roleAuthority);

    List<Authority> findRoleAuthorities(@Param("roleId") Integer roleId);

    List<Authority> findAllRoleAuthorities();

    Authority getAuthorityByAuthorityName(@Param("authorityName") String authorityName);

    void addRoleAuthority(@Param("roleId") Integer roleId, @Param("authorityId") Integer authorityId);

    void deleteUserRole(@Param("roleId") Integer roleId, @Param("authorityId") Integer authorityId);

    List<Authority> findAuthorities();
    void saveAuthority(Authority authority);

    void deleteByAuthorityId(@Param("authorityId") Integer authorityId);

    void update(Authority authority);

    Authority findById(@Param("authorityId") Integer authorityId);
}
